package gwtI18nEditor.widgets;

import java.awt.Component;
import java.awt.Graphics;

import javax.swing.Icon;

public class OverlayIcon implements Icon {
	
	private final Icon base;
	private Icon overlay;
	
	public OverlayIcon(Icon baseIcon) {
		base = baseIcon;
	}
	
	public void setOverlay(Icon overlayIcon) {
		overlay = overlayIcon;
	}
	
	public void removeOverlay() {
		overlay = null;
	}

	@Override
	public int getIconHeight() {
		return base.getIconHeight();
	}

	@Override
	public int getIconWidth() {
		return base.getIconWidth();
	}

	@Override
	public void paintIcon(Component c, Graphics g, int x, int y) {
		base.paintIcon(c, g, x, y);
		if (overlay!=null) overlay.paintIcon(c, g, x, y);
	}
}
